package com.gxgy.app.controller;


import com.gxgy.common.core.domain.R;
import com.gxgy.app.doman.po.User;
import com.gxgy.app.service.UserService;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.time.LocalDateTime;

@RestController("appUserController")
@RequestMapping("/app/user")
public class UserController {

    @Resource
    private UserService userService;

    @PutMapping("/update")
    public R<User> update(@RequestBody User user){
        System.out.println(user);
        user.setUpdateTime(LocalDateTime.now());
        User updatedUser = userService.updateUser(user);
        return R.ok(updatedUser, "修改成功");
    }

}
